<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<link rel="stylesheet" type="text/css" href="../public/bootstrap.min.css" />
		<script src="../public/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../public/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			body {
				background-color: #e5e5e5;
			}
			
			.wrap {
				width: 450px;
				margin: 50px auto;
				border: #757575 1px solid;
				padding: 25px;
				border-radius: 5px;
				background-color: #ffffff;
			}
		</style>
	</head>
	<body>
		<div class="wrap">
			<form id="wzs_form">
				<div class="form-group">
					<label for="exampleInputEmail1">邮箱</label>
					<input type="email" class="form-control" name="email" placeholder="Email">
				</div>
				<div class="form-group">
					<label for="exampleInputPassword1">密码</label>
					<input type="password" class="form-control" name="password" placeholder="Password">
				</div>
				<button type="submit" class="btn btn-default">登录</button>
				</br>
				<div class="register">
					<a href="/regsssss">没有账号？点我注册</a>
				</div>
			</form>
		</div>
		<script type="text/javascript">
			$('#wzs_form').on('submit',function(e){
				e.preventDefault()
				var formData = $(this).serialize()
				/* console.log(formData) */
				$.ajax({
					url:'/register',
					type:'post',
					data:formData,
					dataType:'json',
					success:function(data){
						var code = data.err_cord
						if(code==500){
							alert('服务忙，请稍后重试')
						}if(code==1){
							alert('该用户名或密码错误')
						}if(code==0){
							/* alert('登录成功') */
							//注册成功后直接跳转首页
							window.location.href='/';
						}
					}
				}) 
			})
		</script>

	</body>
</html>
